/*
 * ****************************************************************************
 * Copyright: 2020-2030, YZChain Tech. Co., Ltd.
 * File name:
 * Description:
 * Author: Dc luo
 * Version: v1.0
 * Date: $DATE
 * History:
 * ***************************************************************************
 */

package com.srp.blockchain.bcos.service;

import com.srp.blockchain.bcos.dto.BlockInfoDTO;
import com.srp.blockchain.bcos.dto.ChainStatusDTO;
import com.srp.blockchain.bcos.dto.TransactionDTO;
import org.fisco.bcos.web3j.crypto.Credentials;

import java.io.IOException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.spec.InvalidKeySpecException;

public interface BcosService {

    /**
     * 获取网络状态服务
     *
     * @return json数据集
     */
    ChainStatusDTO getChainStates();

    /**
     * 根据交易哈希查询
     *
     * @return
     */
    TransactionDTO queryTransByHash(String hash);


    /**
     * 根据哈希查询区块数据
     *
     * @return
     */
    BlockInfoDTO queryBlockByHash(String hash);

    /**
     *
     * @param CredentialName
     * @return 根据传入的证书名字读入相应用户证书
     */
    Credentials loadP12AccountByName(String CredentialName) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, NoSuchProviderException, InvalidKeySpecException, UnrecoverableKeyException;
}
